import apis from "@/api/apis.js";
export default {
    namespaced: true,
    state: {
		//初始化导航data
		navData:[],
		//初始化财富直通车
		forTureData:[],
		//初始化财富头条
		headLineData:[]
		
	},
    getters: {},
    mutations: {
		//设置导航数组
		setNavdata(state,newStat){
			state.navData=newStat
		},
		
		//设置财富直通车数组
		setForTureData(state,newStat){
			state.forTureData=newStat
		},
		//设置财富头条
		setHeadLine(state,newStat){
			state.headLineData=newStat
		}
	},
    actions: {
		//获取首页导航
		async getHomeNav(context){
			 let data = await apis.home.getNav();
			if(data.code== 200){
				context.commit("setNavdata",data.data);
			}
		},
		
		//获取财富直通车
		async getForture(context){
			let data =await apis.home.getFortureCar();
			if(data.code== 200){
				context.commit("setForTureData",data.data);
			}
		},
		
		//获取财富头条
		async getHeadsLine(context){
			let data =await apis.home.getHeadsLines();
			if(data.code== 200){
				context.commit("setHeadLine",data.data.list)
			}
		}
	},
    modules: {}
}